package com.sn.test;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.sn.bean.Student;
import com.sn.utils.IResultSetHander;

public class StudentResultSetHandler implements IResultSetHander<List<Student>>{

	@Override
	public List<Student> handle(ResultSet rs) throws Exception {
		List<Student> list = new ArrayList<>();
		while (rs.next()) {
			Student student = new Student();
			student.setId(rs.getLong("id"));
			student.setAge(rs.getInt("age"));
			student.setName(rs.getString("name"));
			list.add(student);
		}
		return list;
	}

}
